ShowTable of Contents
Initial Setup
You will need the following to complete this walkthrough.
-
Domino server.
-
Notes Designer + Admin client.
-
Web Browser.
In the examples below the following refer to your Notes/Domino install location.
-
Domino: C:\Domino
-
Notes: C:\Notes
Change these to match your server as required.
This walkthrough will not go into details of what Web Services are or the internals. Here are some terms that will be used that you should be aware of.
-
Web Service - In its most simple definition. It is a method of two systems to communicate with each other through a common language. For a developer in LotusScript/Java you do not need to worry about how the Domino server communicates with the other system.
-
Provider - The service that is providing the web service. In a server-client relationship, this would be the server.
-
Consumer - The service that is requesting the web service. In a server-client relationship, this would be the client.
-
WSDL - Web Service Definition Language. This is an XML file that describes how a web service provider can be communicated with. Using the WSDL you can automatically create the script library that will handle all communication for you.
-
SOAP - Simple Object Access Protocol. This is the XML messaging system between the consumer and the provider.
-
Endpoint - This is the URL to the web service provider.
For this walkthrough we will be creating the provider and consumer in the same database. To avoid the Domino server from hanging, you will need to allow concurrent web services/agents.
-
Open Domino Administrator.
-
Select the configuration tab and expand "Server" on the right hand side and click "All Server Documents".
-
Expand the list on the right and edit the server document you are working on.
-
Select the "Internet Protocols" tab.
-
Select the "Domino Web Engine" tab.
-
Scroll down to the bottom of the page to the "Web Agents and Web Services" section.
-
Set "Run web agents and web services concurrently?" to "Enabled"
-
Save and close the server document. Close the administrator client.
Make sure that the HTTP process is running. If it isn't you can start it from the Domino console by typing "load http".
Also ensure that the signature you are creating the agents with has the rights to run agents on the server.
Database Setup
1. Start the Designer client.
2. From the menu select "File -> New -> Application".
3. Fill out the dialog as follows.
-
Server:
-
Title: Web Services Hello World
-
Filename: WS.nsf
-
Template: -Blank-
4. Click OK.
5. Modify the database ACL to allow default access as Editor.
Creating the LotusScript provider
1. From your database outline double click the item "Code -> Web Service Providers".
2. Click "New Web Service Provider" button.
3. Fill out the dialog box as follows (leave other fields as the default value)
-
Name: Hello World LS Web Service Provider
-
Alias: HWLSP
-
Type: LotusScript
4. Click OK.
5. In the LotusScript view select "(Declarations)" and type in the following code.
Class hwProvider
Function Hello ( txt as String )
Hello = "Hello " + txt
End Function
End Class
6. Right click anywhere in the code and select "Web Service Properties".
7. Fill out the properties as follows.
-
Tab 1:
-
Port type class: hwProvider
-
Tab 3:
-
Encoding: RPC
-
SOAP message format: RPC/encoded
8. Press CTRL-S to save the web Service. On the third tab, it should automatically fill out the remaining fields. If this does not happen, then type it in yourself as follows.
-
Port type name: hwProvider
-
Service element name: hwProviderService
-
Service port name: Domino
9. Close the web service provider window (and save if required).
Testing the LotusScript provider
At this point your web service WSDL file should be accessible on the server. You can test this by opening a browser and pointing to the following URL. Replace SERVER_NAME with the name of your server (eg. localhost , testserver.lan )
http://SERVER_NAME/WS.nsf/HWLSP?WSDL
This will display the XML details of your web service provider. You do not need to worry about what is contained in this XML as the Designer client will do the work for you.
Sample:

Creating the Java provider
1. In the Designer client, if you are not already at the Web Service Provider view then double click the item "Code -> Web Service Providers"
2. Click "New Web Service Provider" button.
3. Fill out the dialog box as follows (leave other fields as the default values)
-
Name: Hello World Java Web Service Provider
-
Alias: HWJP
-
Type: Java
5. Click OK.
6. Click "New Java Class" and fill out the dialog box as follows (leave other fields as the default values).
7. Click OK.
8. Replace the code in the Java script window with the following.
public class HwProvider {
public String hello (String txt) {
return "Hello " + txt;
}
}
9. Save and close the script window.
10. From the Properties window / Basics tab, click on "Port type class" drop down and select "HwProvider".
11. Click the Advanced Tab in the Properties window and change the following.
-
Programming model: RPC
-
SOAP message format: RPC/encoded
12. Press CTRL-S to save. Click on the window to confirm that the following in the advanced tab is filled in (if not then manually fill in).
-
Port type name: HwProvider
-
Service element name: HwProviderService
-
Service port name: Domino
13. Close the Java web service provider window. Save if required.
Testing the Java provider
Like before you can check if your WSDL file is being generated by using the following URL. Again replace SERVER_NAME with the name of your server (eg. localhost , testserver.lan)
http://SERVER_NAME/WS.nsf/HWJP?WSDL
Creating consumers
To demonstrate the power of web services, the consumers will talk to the alternate language provider, as shown in the diagram below.

Creating the Java Consumer to connect to the LotusScript Provider
1. From the database outline in Designer double click "Code -> Web Service Consumers".
2. Click "New Web Service Consumer".
3. Fill out the dialog box as follows (leave the other options as the default).
-
Name: HWJC
-
Type: Java
-
Get Web Service Description from: (Replace SERVER_NAME with your servers name).
http://SERVER_NAME/WS.nsf/HWLSP?WSDL
4. Click OK.
5. Save and close the consumer window.
Creating the LotusScript Consumer to connect to the Java Provider
1. From the database outline in Designer, double click "Code -> Web Service Consumers".
2. Click "New Web Service Consumer".
3. Fill out the dialog box as follows (leave the other options as the default).
-
Name: HWLSC
-
Type: LotusScript
-
Get Web Service Description from: (Replace SERVER_NAME with your servers name).
http://SERVER_NAME/WS.nsf/HWJP?WSDL
4. Click OK
5. Save and close the consumer window.
Creating the LotusScript agent to test the LotusScript Consumer
1. From the database outline in Designer double click "Code -> Agents".
2. Click "New Agent" and fill out the dialog as follows (leave the rest as the default).
-
Name: TestLS
-
Type: LotusScript
3. Click OK.
4. In the Agent properties set the following.
-
Trigger: On Event
-
Action Menu Selection
-
Target: None
5. In the script window replace with the following code.
Option Public
Option Declare
Use "HWLSC"
Sub Initialize
Dim stub As New HwProvider()
MessageBox stub.Hello("world")
End Sub
6. Save and close the agent.
7. From the Agent list window, right click the agent and select "Run". A message box will appear saying "Hello World".
Creating the Java agent to test the Java Consumer
1. From the database outline in Designer, double click "Code -> Agents".
2. Click "New Agent" and fill out the dialog as follows (leaving the rest as the default).
-
Name: TestJava
-
Type: Java
3. In the Agent properties (Basics) set the following.
-
Trigger: On Event
-
Action Menu Selection
-
Target: None
4. Click "Import" and select "Web Service Consumer".
5. Select "HWJC" and click "Import".
6. Double click "JavaAgent.java" and replace with the following code.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
HwProvider stub = new HwProviderServiceLocator().getDomino();
String answer = "" + stub.HELLO("world");
System.out.println("The answer is : " + answer);
} catch (Exception e) {
e.printStackTrace();
}
}
}
7. Save and close the script, then save and close the agent.
8. From the agent list window, right click the agent and select "Run".
9. From the tools menu select "Show Java Debug Console". There will be a message that says "The answer is : Hello World".